<style>
    .panel-custom {
        border-color: #92278f;
    }
    .panel-custom>.panel-heading {
        color: #fff;
        background-color: #92278f;
        border-color: #92278f;
    }
    .table-hover>tbody>tr{
        cursor: pointer;
    }
    .table-hover>tbody>tr:hover {
        background-color: #2dadf5;
    }
</style>
<div class="container" ng-controller="newConfigCtrl" ng-init="init()">
    <div class="col-md-6" style="padding: 2px;">
        <div class="panel panel-custom" style="min-height: 400px;">
            <div class="panel-heading">
                <h3 class="panel-title">编辑窗口</h3>
                <div class="pull-right btn-toolbar" style="margin-top: -24px;">
                    <a class="btn btn-success btn-sm" ng-click="templatePreview()">预览</a>
                    <a class="btn btn-danger btn-sm" ng-click="sendConfig()">保存</a>
                </div>
            </div>
            <div class="panel-body">
                <form class="form-horizontal" role="form">
                    <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">消息模板</label>
                        <div class="col-sm-10">
                            <select class="form-control" id="template_select" ng-model="selectedTemplate"
                                    ng-options="_item.name for _item in templateList" ng-change="changeTemplate()">
                                <option value="" class="" selected="selected">-- 请选择 --</option>
                            </select>
                        </div>
                    </div>
                   <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">规则名称&编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="template_rule" required
                                   placeholder="请填写规则名称&编号。">
                        </div>
                    </div>
                   <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">计算公式</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="template_expression" required
                                   placeholder="请填写计算公式。">
                        </div>
                    </div>
                   <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">组织站点</label>
                        <div class="col-sm-10">
                            <i class="clearable glyphicon glyphicon-remove" ng-click="clearCompanyQuery()"
                               style="position: absolute; top: 10px; right: 20px; z-index: 4; cursor: pointer; font-size: 12px; display: block;"></i>
                            <input type="text" class="form-control" ng-model="template_company_query" ng-change="companyQuery()"
                                   placeholder="请填写站点名称，支持模糊查询。" id="dLabel" role="button" data-toggle="dropdown">
                            <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"
                                style="margin: 2px 14px;overflow: auto;width: 93.8%;max-height: 380px;">
                                <table class="table table-condensed table-sm table-hover" style="margin: 0;">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>组织名称</th>
                                        <th>站点名称</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="_item in companyList" ng-click="selectCompany(_item)">
                                        <td class="col-md-2"><span ng-bind="$index+1"></span></td>
                                        <td class="col-md-5"><span ng-bind="_item.orgName"></span></td>
                                        <td class="col-md-5"><span ng-bind="_item.siteName"></span></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </ul>
                        </div>
                    </div>
                   <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">组织编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="template_orgId" required
                                   placeholder="请填写组织编号。">
                        </div>
                    </div>
                  <div class="form-group">
                        <label for="template_select" class="col-sm-2 control-label">站点编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="template_siteId" required
                                   placeholder="请填写站点编号。">
                        </div>
                    </div>
                    <hr style="border-top: 2px dashed #777;" />
                    <h5 style="margin-top: -29px;padding-left: 20px;font-weight: bold;">模板参数列表</h5>
                    <div class="form-group" ng-repeat="_item in paramsArray">
                        <label class="col-sm-2 control-label" ng-bind="_item.description"></label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="_item.value" required="{{_item.required}}"
                                   placeholder="{{_item.placeholder}}">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="col-md-6" style="padding: 2px;">
        <div class="well well-lg" style="min-height: 400px;">
            <div style="margin: -25px;padding: 10px 15px;margin-bottom: 5px;background-color: #145c77;border-radius: 5px 4px 0px 0px;">
                <span style="color: #FFF;">预览窗口</span>
            </div>
            <div class="form-group" style="margin: 0 -15px -15px -15px;">
                <textarea class="form-control ng-binding" ng-bind="preview_html" style="min-height: 400px;width: 550px;"></textarea>
            </div>
        </div>
    </div>
</div>